package com.wswy.wzcx.utils;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetDialog;
import android.view.View;
import com.wswy.wzcx.R;

/**
 * Created by zl on 2017/12/18.
 */

public class ShareDialog extends BottomSheetDialog implements View.OnClickListener {


  private OnChooseShareTypeCallback mCallback;

  public ShareDialog(@NonNull Context context,OnChooseShareTypeCallback callback) {
    super(context);
    mCallback = callback;
    setContentView(R.layout.dialog_share);

    findViewById(R.id.share_timeline).setOnClickListener(this);
    findViewById(R.id.share_friend).setOnClickListener(this);
    findViewById(R.id.tv_cancel).setOnClickListener(this);


  }

  public void onClick(View view){
    int id = view.getId();
    if(id == R.id.share_timeline){
      //微信朋友圈
      if(mCallback != null){
        mCallback.onChooseType(ShareHelper.TYPE_WX_TIMELINE);
      }
    }else if(id == R.id.share_friend){
      //微信好友
      if(mCallback != null){
        mCallback.onChooseType(ShareHelper.TYPE_WX_FRIEND);
      }
    }else if(id == R.id.tv_cancel){
      //取消
    }

    dismiss();
  }


  public interface OnChooseShareTypeCallback{
    void onChooseType(int shareType);
  }

}
